/**
 * 向vue组件混入通用公共函数
 * @type {{install(*, *): void}}
 */
const CommonAPI = {
    install(Vue,options) {
        Vue.mixin({
            methods: {
                copyField(source,target) {
                    if (!(source instanceof Object) && !(target instanceof Object)) {
                        throw new Error("param is not a object")
                    }
                    Object.keys(target).forEach(key => {
                        target[key] = source[key]
                    })
                }
            }
        })
    }
}

export default CommonAPI